package com.pzh.guli.service.statics.controller;


import com.pzh.guli.service.base.result.Result;
import com.pzh.guli.service.statics.service.IDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xzh
 * @since 2022-07-23
 */
@RestController
@RequestMapping("api/statics")
public class DailyController {
    @Autowired
    private IDailyService dailyService;
    @PostMapping("create/{day}")
    public Result createStatics(@PathVariable String day){
        dailyService.createStaticsByDay(day);
        return Result.ok().message("统计数据生成成功");
    }
    @GetMapping("chart/{begin}/{end}")
    public Result showEcharts(@PathVariable String begin,@PathVariable String end){
        Map<String, Map<String, Object>> map=dailyService.showEchartsBytime(begin,end);
        return Result.ok().data("items",map);
    }
}

